home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / dev / c / libiconv_src.lha / extras / iconv.m4 < prev    next >
Encoding:
M4 Source File  |  2000-11-07  |  1.1 KB  |  40 lines

  1. #serial 1
  2.  
  3. dnl From Bruno Haible.
  4.  
  5. AC_DEFUN(jm_ICONV,
  6. [
  7.   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
  8.   dnl those with the standalone portable libiconv installed).
  9.   AC_CACHE_CHECK(for iconv, jm_cv_func_iconv, [
  10.     jm_cv_func_iconv="no, consider installing libiconv"
  11.     jm_cv_lib_iconv=no
  12.     AC_TRY_LINK([#include <stdlib.h>
  13. #include <iconv.h>],
  14.       [iconv_t cd = iconv_open("","");
  15.        iconv(cd,NULL,NULL,NULL,NULL);
  16.        iconv_close(cd);],
  17.       jm_cv_func_iconv=yes)
  18.     if test "$jm_cv_func_iconv" != yes; then
  19.       jm_save_LIBS="$LIBS"
  20.       LIBS="$LIBS -liconv"
  21.       AC_TRY_LINK([#include <stdlib.h>
  22. #include <iconv.h>],
  23.         [iconv_t cd = iconv_open("","");
  24.          iconv(cd,NULL,NULL,NULL,NULL);
  25.          iconv_close(cd);],
  26.         jm_cv_lib_iconv=yes
  27.         jm_cv_func_iconv=yes)
  28.       LIBS="$jm_save_LIBS"
  29.     fi
  30.   ])
  31.   if test "$jm_cv_func_iconv" = yes; then
  32.     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
  33.   fi
  34.   LIBICONV=
  35.   if test "$jm_cv_lib_iconv" = yes; then
  36.     LIBICONV="-liconv"
  37.   fi
  38.   AC_SUBST(LIBICONV)
  39. ])
  40.